package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(30);not null;comment:'用户'"`
	Password string `gorm:"type:char(32);not null;comment:'密码'"`
	Info     string `gorm:"type:varchar(200);not null;comment:'简介'"`
}

func (u *User) InfoGetUser(db *gorm.DB, username string) error {
	err := db.Model(User{}).Where("username =?", username).Limit(1).Find(&u).Error
	return err
}
func (u *User) CreateUser(db *gorm.DB) error {
	err := db.Create(&u).Error
	return err
}
